package com.kanas.webak.config.domain;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

import com.kanas.framework.support.AbstractModel;

@Entity(name="KanasPropertiesGroup")
@Table(name="kanas_properties_group")
@JsonIgnoreProperties({"properties"})
public class PropertiesGroup extends AbstractModel {

	@Transient
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="code", length=20)
	private String code;
	@Column(name="sort_number")
	private Integer sortNumber;
	@OneToMany(mappedBy = "group", cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH}, fetch = FetchType.LAZY)
	private Set<Properties> properties;
	
	public PropertiesGroup() {}
	
	public Integer getSortNumber() {
		return sortNumber;
	}

	public void setSortNumber(Integer sortNumber) {
		this.sortNumber = sortNumber;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Set<Properties> getProperties() {
		return properties;
	}

	public void setProperties(Set<Properties> properties) {
		this.properties = properties;
	}

	@Override
	public String toIdString() {
		return code;
	}

}
